<?#//v.3.0.0
# ///////////////////////////////////////////////////////
# //  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
# ///////////////////////////////////////////////////////
include "./includes/config.inc.php";
$TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);

if($_POST['action']=='sendtoposter' && phpa_securepost($_POST)) {
	if(empty($_POST['auction'])) {
		$TPL_errmsg = $MSG_30_0152;
	} else {
		#// Does the auction exist?
		if(!@mysql_result(@mysql_query("SELECT id FROM PHPAUCTIONXL_auctions WHERE id=".intval($_POST['auction'])." AND closed='0' AND user=".$_SESSION["PHPAUCTION_LOGGED_IN"]),0,"id")) {
			$TPL_errmsg = $MSG_30_0153;
		} else {
			#// Send notification
			$POSTER=@mysql_fetch_array(@mysql_query("SELECT email,nick FROM PHPAUCTIONXL_users WHERE id=".intval($_POST['poster'])));
			$USERLANG = @mysql_result(@mysql_query("SELECT language FROM PHPAUCTIONXL_userslanguage WHERE user=".intval($_POST['poster'])),0,"language");
			if(!isset($USERLANG)) $USERLANG = $SETTINGS['defaultlanguage'];
			include $include_path."wanteditem_notification.".$USERLANG.".inc.php";
			if(!mail($to,$subject,$message,$from)){
				$TPL_errmsg = $MSG_30_0154;
			}else{
				$TPL_errmsg = $MSG_30_0155;
				@mysql_query("UPDATE PHPAUCTIONXL_wanted SET answers=answers+1 WHERE id=".intval($_POST['adid']));
			}
		}
	}
}
include("header.php");
include(phpa_include("template_respondad_php.html"));
include("footer.php");

?>